<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<style>
.error {
	color: #ff0000;
}
 
.errorblock {
	color: #000;
	background-color: #ffEEEE;
	border: 3px solid #ff0000;
	padding: 8px;
	margin: 16px;
}
</style>
</head>
<body>
	<h2>Login Form</h2>
 
	<form:form method="POST" name="loginFrm" modelAttribute="userDetail">
		<table>
			<c:if  test="${userDerail == 0}">
			<tr>
				<td></td>
				<td class="errorblock">
					Username and password miss match
				</td>
			</tr>
			</c:if>
			
			<tr>
				<td>UserName :</td>
				<td>
					<input type="text" name="login" id="login" />
				</td>
			</tr>
			<tr>
				<td>Password :</td>
				<td>
					<input type="password" name="password" id="password" /> 
				</td>
			</tr>
			<tr>
				<td><input type="button" value="Login" onclick="callLoginAction()"  /></td>
				<td><input type="button" value="Register" onclick="callRegisterAction()" /></td>
			</tr>
		</table>
	</form:form>
	<form method="get" name="testFrm">
		<table>
			<tr>
				<td>UserName :</td>
				<td>
					<input type="text" name="login" id="login" />
				</td>
			</tr>
			<tr>
				<td><input type="button" value="Login" onclick="testMe()"  /></td>
				<td><input type="button" value="Register" onclick="callRegisterAction()" /></td>
			</tr>
		</table>
	</form>
</body>
<script>
	function callLoginAction()
	{
		document.loginFrm.action = "<%= request.getContextPath()%>/checkLogin/login";
		document.loginFrm.submit();
	}
	function testMe()
	{
		document.testFrm.action = "<%= request.getContextPath()%>/checkLogin/TestMe/testLogin";
		document.testFrm.submit();
	}
	function callRegisterAction()
	{
		document.loginFrm.action = "<%= request.getContextPath()%>/checkLogin/register";
		document.loginFrm.submit();
	}
</script>
</html>
